package view

/*
	CONSTANT_MethodType_info {
	    u1 tag; // 常量类型标签，必须为 CONSTANT_MethodType_info
	    u1 count; // 参数类型数量
	    u2 types[count]; // 参数类型列表
	}
*/
type Constant_Method_Type struct {
	Tag uint8
	//ParamTypeLen  uint8
	//ParamTypeList []Constant
	DescriptorIndex uint16
}

func (self *Constant_Method_Type) ReadConstant(cr *ClassReader) {
	self.DescriptorIndex = cr.readUInt16(cr.readUInt8s2(2))
	//if self.ParamTypeLen > 0 {
	//	self.ParamTypeList = make([]Constant, self.ParamTypeLen)
	//	for i := 0; i < int(self.ParamTypeLen); i++ {
	//		var constant, _ = NewConstantInfo(cr.readUInt8())
	//		self.ParamTypeList[i] = constant
	//	}
	//}
}
func (self *Constant_Method_Type) ReadValue(cr ClassReader, cp ConstantPoolInfo) {

}

/*
		CONSTANT_MethodHandle_info {
	    u1 tag; // 常量类型标签，必须为 CONSTANT_MethodHandle_info
	    u1 reference_kind; // 引用类型
	    u2 reference_index; // 引用索引
	}
*/
type Constant_Method_Handle struct {
	Tag      uint8
	RefType  uint8
	RefIndex uint16
}

func (self *Constant_Method_Handle) ReadConstant(cr *ClassReader) {
	self.RefType = cr.readUInt8()
	self.RefIndex = cr.readUInt16(cr.readUInt8s(2))
}
func (self *Constant_Method_Handle) ReadValue(cr ClassReader, cp ConstantPoolInfo) {

}

/*
*

	CONSTANT_InvokeDynamic_info {
	    u1 tag; // 常量类型标签，必须为 CONSTANT_InvokeDynamic_info
	    u2 bootstrap_method_attr_index; // 引导方法属性的索引
	    u2 name_and_type_index; // 方法名和类型信息的索引
	}
*/
type Constant_InvokeDynamic struct {
	Tag                      uint8
	BootStrapMethodAttrIndex uint16
	NameAndTypeIndex         uint16
	NameAndType_             NameAndType
}

func (self *Constant_InvokeDynamic) ReadConstant(cr *ClassReader) {
	self.BootStrapMethodAttrIndex = cr.readUInt16(cr.readUInt8s(2))
	self.NameAndTypeIndex = cr.readUInt16(cr.readUInt8s(2))
}
func (self *Constant_InvokeDynamic) ReadValue(cr ClassReader, cp ConstantPoolInfo) {

}
